<template>
	<view>
		<view v-if='dataList.length!==0'>
			<view class='header'>
				<view>富阳区行政事业单位资产清查汇总表</view>
			</view>
			<view class='container'>
				<view style='display: flex;font-size: 10px;'>
					<view style='flex:3'>填报单位: {{dataList[0].enterpriseName}}</view>
					<view style='flex:1;text-align: right;'>金额:元</view>
				</view>
				<view class='tableWrap'>
					<!--  -->
					<vxe-table :height="initHeight" :data="dataList" border resizable show-overflow style="width: 100%"
					 show-footer-overflow show-footer :footer-method="footerMethod" :header-cell-style="{
				          'font-size':'13px',
				          'font-weight':'400',
				          'background-color': 'rgb(64, 158, 255)',
				          'color':'#fff',
				          'text-align':'center',
						  'line-height':'14px'
				        }"
					 :cell-style="{
				          'text-align':'center',
						  'font-size':'12px',
						  'line-height':'14px'
				        }">
						<vxe-table-column fixed="left" title="序号" width="40" field="code" />
						<vxe-table-column fixed="left" title="资产名称" width="110" field="name" />
						<vxe-table-column title="资产管理系统数">
							<vxe-table-column field="sysAssetCount" title="①数量" width="100" />
							<vxe-table-column field="sysAssetValue" title="②原值" width="100" />
							<vxe-table-column field="sysAssetNet" title="③净值" width="100" />
						</vxe-table-column>
						<vxe-table-column title="财务账面数">
							<vxe-table-column field="financeCount" title="④数量" width="100" />
							<vxe-table-column field="financeValue" title="⑤原值" width="100" />
							<vxe-table-column field="financeNet" title="⑥净值" width="100" />
						</vxe-table-column>
						<vxe-table-column title="清查变动情况(系统账)">
							<vxe-table-column title="增加">
								<vxe-table-column field="sysFinanceAddCount" title="⑦数量" width="100" />
								<vxe-table-column field="sysFinanceAddValue" title="⑧原值" width="100" />
							</vxe-table-column>
							<vxe-table-column title="减少">
								<vxe-table-column field="sysFinanceDelCount" title="⑨数量" width="100" />
								<vxe-table-column field="sysFinanceDelValue" title="⑩原值" width="100" />
							</vxe-table-column>
						</vxe-table-column>
						<vxe-table-column title="实际盘点数">
							<vxe-table-column field="actualCount" title="⑪=④+⑦-⑨数量" width="120" />
							<vxe-table-column field="actualValue" title="⑫=⑤+⑧-⑩原值" width="120" />
						</vxe-table-column>
						<vxe-table-column field="reason" title="变动原因说明" width="120" />

					</vxe-table>

				</view>

			</view>
		</view>
		<view v-else style='text-align: center;'>
			<image mode='aspectFit' style='height: 500px;width: 300px;'  src='../../../../../static/img/loading.png' />
		</view>
	</view>
</template>

<script>
	import XEUtils from 'xe-utils'
	export default {
		props: {
			dataList: {
				type: Array,
				default: {}
			}
		},
		data() {
			return {
				loading: false,
				tableData: [],
				initHeight: ''
			}
		},
		created() {
			this.initHeight = document.body.clientHeight - 180
		},
		methods: {


			footerMethod({
				columns,
				data
			}) {
				const footerData = [
					columns.map((column, columnIndex) => {
						if (columnIndex == 0) {
							return '合计'
						} else {
							if (column.property == 'name' || column.property == 'reason') {
								return '--'
							} else {
								let newData = []
								newData.push(data[0])
								newData.push(data[8])
								newData.push(data[13])
								return XEUtils.sum(newData, column.property)
							}
						}
					})
				]
				return footerData
			},

		}
	}
</script>

<style scoped lang='scss'>
	.tableWrap /deep/ .vxe-table .vxe-cell {
		white-space: pre-line;
		word-break: break-all;
		padding-left: 0px !important;
		padding-right: 0px !important;
	}

	.tableWrap /deep/ .vxe-table .vxe-header--column:not(.col--ellipsis) {
		padding: 5px 0;
		overflow-x: auto;
	}

	.tableWrap /deep/ .vxe-table .vxe-body--column.col--ellipsis,
	.vxe-table.vxe-editable .vxe-body--column,
	.vxe-table .vxe-footer--column.col--ellipsis,
	.vxe-table .vxe-header--column.col--ellipsis {
		height: 36px;
	}

	.header {
		text-align: center;
		text-align: center;
		font-size: 16px;
		margin-top: 5px;
	}

	.dateTitle {
		margin-top: 8px;
		font-size: 13px;
		color: gray;
	}

	.container {
		margin-top: 5px;
		padding: 5px 10px;
		background: #fff;
		margin: 8px 0px;
	}

	.tableWrap {
		margin-top: 10px;
	}
</style>
